from applications.extensions import ma
from marshmallow import fields, validate


class DeptInSchema(ma.Schema):
    code = fields.Str(required=True)
    parentId = fields.Integer(required=True)
    deptName = fields.Str(required=True)
    leader = fields.Str(required=True)
    phone = fields.Str(required=True)
    remark = fields.Str(required=True)



class DeptOutSchema(ma.Schema):
    deptId = fields.Integer(attribute="id")
    code = fields.Str(attribute="code")
    parentId = fields.Integer(attribute="parent_id")
    deptName = fields.Str(attribute="dept_name")
    leader = fields.Str()
    phone = fields.Str()
    sort = fields.Integer()
